package com.ebocy.hammer.world.message;

import java.util.List;

import com.ebocy.hammer.core.constants.GameMessageCode;
import com.ebocy.hammer.core.message.AbstractS2CMessage;

public class S2CJoin4V4RoomMessage extends AbstractS2CMessage {

	List<RoomPlayerInfo> memberInfoList;

	public S2CJoin4V4RoomMessage(List<RoomPlayerInfo> memberInfoList) {
		this.memberInfoList = memberInfoList;
	}

	@Override
	protected void writeMessage() {
		writeShort((short)this.memberInfoList.size());
		for (RoomPlayerInfo playerInfo : this.memberInfoList) {
			writeString(String.valueOf(playerInfo.playerId));
			writeString(playerInfo.name);
			writeString(playerInfo.icon);
			writeInt(playerInfo.roleImage);
			writeInt(playerInfo.hammerId);
//			if (playerInfo.buffer != null && playerInfo.buffer.size() > 0) {
//				writeShort((short)playerInfo.buffer.size());
//				for (MemberBuffer buffer : playerInfo.buffer) {
//					writeLong(buffer.bufferInstanceId);
//					writeLong(buffer.bufferId);
//				}
//			}
		}
	}

	@Override
	public short getMessageCode() {
		return GameMessageCode.WORLD_ENTER_4V4_ROOM;
	}

}
